{% extends 'base.html' %}
{% block title %}作者列表 - Local Library{% endblock %}
{% block content %}
    <h1>作者列表</h1>
    {% if author_list %}
        <div class="cards-row" style="flex-wrap:wrap;gap:20px;">
            {% for author in author_list %}
            <div class="info-card" style="min-width:260px;max-width:320px;flex:1 1 260px;">
                <div class="info-card-title" style="font-size:1.18rem;">👤 {{ author.last_name }}{{ author.first_name }}</div>
                <div class="info-item"><b>出生日期：</b>{{ author.date_of_birth }}</div>
                <div class="info-item"><b>去世日期：</b>{{ author.date_of_death|default:'--' }}</div>
                <div class="info-item"><b>作品数量：</b>{{ author.book_count|default:'--' }}</div>
                {% if author.intro %}<div class="info-item"><b>简介：</b>{{ author.intro|truncatechars:40 }}</div>{% endif %}
                <div style="margin-top:10px;"><a href="{% url 'author-detail' author.pk %}" class="btn" style="padding:6px 18px;font-size:0.98rem;">详情</a></div>
            </div>
            {% endfor %}
        </div>
        {% if is_paginated %}
            <div class="pagination">
                {% if page_obj.has_previous %}
                    <a href="?page={{ page_obj.previous_page_number }}">上一页</a>
                {% endif %}
                <span>第 {{ page_obj.number }} 页，共 {{ page_obj.paginator.num_pages }} 页</span>
                {% if page_obj.has_next %}
                    <a href="?page={{ page_obj.next_page_number }}">下一页</a>
                {% endif %}
            </div>
        {% endif %}
    {% else %}
        <p>暂无作者信息。</p>
    {% endif %}
{% endblock %} 